:- module net. :- public main / 0, restart / 0. :- extrn main_hlpr / 0. 1 1 : 0 1 0 : 1 0 1 : 1 0 0 : 0 formula : A or B Formulas attachted to nodes : Input to node = input from node formula Input from formula = if formula is a node output then that output else if formula = not formula1 then Activation of an NOT node Result := ( 1 - INPUT ) Activation of an OR node begin Result := 0; for i ranging over all inputs to this node do Result := Result + ( 1 - Result ) * OUTPUT(i) * EDGE_FROM_i end. Activation of an AND node begin Result := 1; for i ranging over all inputs to this node do Result := Result * OUTPUT(i) * EDGE_FROM_i end. ARCHITECTURE OF NETWORK 1. Given input nodes and their NOTs 2. 1st hidden layer : some number of AND nodes 3: output layer : a problem-specific number of OR nodes LEARNING ALGORITHM Starting at the output and working toward the input, do repeat, Compute desired change of a neuron. Compute desired changes of edges leading to it. Move 1 layer toward input Desired change of a neuron : Output Neuron : ( DESIRED - ACTUAL ) Hidden neuron: Let wij be an edge to neuron j in the next layer SUM wij * CHANGE(J) edges to next layer Desired change of an edge : Let wij be an edge from neuron i to neuron j in the next layer. CHANGE( wij ) = ACTIVATION( i ) * change( j ) NEW EDGE WEIGHT GIVEN CHANGE if change > 0 then new := current + ( 1 - current ) * change if change < 0 then new := current + current * change INITIALIZATION Edges based on intuition When you don't know, make it a 1. Hidden layer generation Given : list of input neurons I1, I2, I3, I4, Hidden layer 1 : attached formulas on edges E1_1 I1 & I2 & I3 & I4 E1_2 I1 & I2 & I3 & -I4 E1_3 I1 & I2 & -I3 & I4 E1_4 I1 & I2 & -I3 & -I4 E1_5 I1 & -I2 & I3 & I4 E1_6 I1 & -I2 & I3 & -I4 E1_7 I1 & -I2 & -I3 & I4 E1_8 I1 & -I2 & -I3 & -I4 E1_9 -I1 & I2 & I3 & I4 E1_10 -I1 & I2 & I3 & -I4 E1_11 -I1 & I2 & -I3 & I4 E1_12 -I1 & I2 & -I3 & -I4 E1_13 -I1 & -I2 & I3 & I4 E1_14 -I1 & -I2 & I3 & -I4 E1_15 -I1 & -I2 & -I3 & I4 E1_16 -I1 & -I2 & -I3 & -I4 Hidden layer 2 : neuron( LAYER , NUMBER, FORMULA ). LAYER = input, not( NUMBER), and, or OUTPUT_LAYER, INPUT_NEURON, OUTPUT_NEURON, TIME, ACTIVATION). input( KEY, NEURON_NUMBER, ACTIVATION). output( KEY, NEURON_NUMBER, ACTIVATION). state( neuron, LAYER, NUMBER, TIME, ACTIVATION). state( edge , OUTPUT_LAYER, INPUT_NEURON, OUTPUT_NEURON, TIME, ACTIVATION). input( KEY, NEURON_NUMBER, ACTIVATION). output( KEY, NEURON_NUMBER, ACTIVATION). %%%%%%%%%%%%%%% main program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% main :- main_hlpr. restart :- halt. %%%%%%%%%%%%%%%%%% eof %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5